package com.dietmanager.model;

import java.util.ArrayList;

public class Recipe extends FoodModel {

	private ArrayList<FoodModel> items = new ArrayList<>();

	public Recipe(String name, int amount) {
		super(name, amount);
	}

	public void add(FoodModel food) {
		items.add(food);
	}
	
	public void remove(FoodModel food){
		items.remove(food);
	}

	@Override
	public int getCalories() {
		int calories = 0;
		
		for(FoodModel item : items)
			calories += item.getCalories();
		
		return calories;
	}	

	@Override
	public int getFat() {
		int fat = 0;
		
		for(FoodModel item : items)
			fat += item.getFat();
		
		return fat;
	}	

	@Override
	public int getCarbohydrates() {
		int carbohydrates = 0;
		
		for(FoodModel item : items)
			carbohydrates += item.getCarbohydrates();
		
		return carbohydrates;
	}

	@Override
	public int getProtein() {
		int protein = 0;
		
		for(FoodModel item : items)
			protein += item.getProtein();
		
		return protein;
	}

	

}
